<?php
session_start();
	function checkusername($user,$pwd){
		include "con.php";
		$result=mysql_query("select * from APP where UserName='".$user."'");	
		while($row = mysql_fetch_array($result))
  		{
 		if ($row["PassWord"]==$pwd) {
 			$_SESSION["user"]=$user;
 			return true;
 			}
  		}
  		return false;
	}

	function addusername($user,$pwd){
		include "con.php";
		mysql_query("insert into APP (UserName,PassWord) values ('".$user."','".$pwd."')");
		$_SESSION["user"]=$user;
		return true;
	}

	function addtext($text){
		include "con.php";
		$user=$_SESSION["user"];
		mysql_query("update APP set Message='".$text."' where UserName='".$user."'");
	}

	function gtext(){
	 	include "con.php";
		$user=$_SESSION["user"];
		$result=mysql_query("select * from APP where UserName='".$user."'");
		while($row = mysql_fetch_array($result))
  		{
  		echo $row["Message"];
  		}
	}
?>